import { BASE_URL } from '@/config/public'
import { METHOD, request } from '@/utils/request'

// //app使用密码登录的验证码接口
// function vertifyCode(params) {
//   return request(`${BASE_URL}/provider/Kaptcha.jpg`, METHOD.GET, params)
// }
// // 根据手机号获取登录验证码
// function getCodeByPhoneNumber(params) {
//   return request(`${BASE_URL}/provider/ims/ejbb/sms/validatecode`, METHOD.GET, params)
// }
// // 登录接口
// function login(params) {
//   return request(`${BASE_URL}/provider/ims/ejbb/password/login`,  METHOD.POST_JSON_ENCRYPT, params)
// }
let API = {
  // app使用密码登录的验证码接口
  vertifyCode: params => {
    return request(`${BASE_URL}/provider/Kaptcha.jpg`, METHOD.GET, params, {
      responseType: 'blob',
      isNeedToken: false
    })
  },
  // 根据手机号获取登录验证码
  getCodeByPhoneNumber: params => {
    return request(
      `${BASE_URL}/provider/ims/ejbb/sms/validatecode`,
      METHOD.GET,
      params,
      { isNeedToken: false }
    )
  },
  //仅wx端使用code登录接口
  wxloginCode: params => {
    return request(
      `${BASE_URL}/provider/ims/ejbb/wechat/code/login?code=${params.code}`,
      METHOD.POST_JSON_ENCRYPT,
      params,
      { isNeedToken: false }
    )
  },
  // app使用密码登录接口--wx
  wxloginByPsd: params => {
    return request(
      `${BASE_URL}/provider/ims/ejbb/wechat/password/login`,
      METHOD.POST_JSON_ENCRYPT,
      params,
      { isNeedToken: false }
    )
  },
  // wx
  wxloginByMsg: params => {
    return request(
      `${BASE_URL}/provider/ims/ejbb/wechat/sms/validatecode/login`,
      METHOD.POST_JSON_ENCRYPT,
      params,
      { isNeedToken: false }
    )
  },
  // app使用密码登录接口
  loginByPsd: params => {
    return request(
      `${BASE_URL}/provider/ims/ejbb/password/login`,
      METHOD.POST_JSON_ENCRYPT,
      params,
      { isNeedToken: false }
    )
  },
  loginByMsg: params => {
    return request(
      `${BASE_URL}/provider/ims/ejbb/sms/validatecode/login`,
      METHOD.POST_JSON_ENCRYPT,
      params,
      { isNeedToken: false }
    )
  }
}
export default API
